package Demo4;

public class TestBinaryTree {
    public static void main(String[] args) {
        BinaryTree binaryTree=new BinaryTree();
        BinaryTree.TreeNode root=binaryTree.createTree();
        //前序遍历
        binaryTree.preOrder(root);
        System.out.println();
        //中序遍历
        binaryTree.inOrder(root);
        System.out.println();
        //后序遍历
        binaryTree.postOrder(root);
        System.out.println();
        binaryTree.size(root);
        System.out.println("结点个数为"+binaryTree.count);
       int ret=binaryTree.nodeSize(root);
        System.out.println("结点个数ret="+ret);
        binaryTree. getLeafNodeCount(root);
        System.out.println("叶子节点个数为"+binaryTree.leafCount);
        int ret2=binaryTree. getLeafNodeCount2(root);
        System.out.println("叶子节点个数ret2="+ret2);
        int ret3=binaryTree.getKLeafNodeCount(root,3);
        System.out.println(ret3);
        int Height=binaryTree.getHeight(root);
        System.out.println(Height);
        BinaryTree.TreeNode ret4=binaryTree.find(root,'A');
        System.out.println(ret4);
    }

}
